<!-- 本示例未包含完整css，获取外链css请参考上文，在hello uni-app项目中查看 -->
<template>
  <view class="content">
    <view class="uni-padding-wrap">
      <view class="uni-title uni-common-mt">
        数组类型
        <text>\nnodes属性为Array</text>
      </view>
      <view class="uni-common-mt" style="background:#FFF; padding:20rpx;">
        <rich-text :nodes="nodes"></rich-text>
      </view>
      <view class="uni-title uni-common-mt">
        字符串类型
        <text>\nnodes属性为String</text>
      </view>
      <view class="uni-common-mt" style="background:#FFF; padding:20rpx;">
        <rich-text :nodes="strings"></rich-text>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      nodes: [{
        name: 'div',
        attrs: {
          class: 'div-class',
          style: 'line-height: 60px; color: red; text-align:center;'
        },
        children: [{
          type: 'text',
          text: 'Hello&nbsp;uni-app!'
        }]
      }],
      strings: '<div style="text-align:center;"><img src="https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-uni-app-doc/d8590190-4f28-11eb-b680-7980c8a877b8.png"/></div>'
    }
  }
}
</script>

<style scoped>

</style>
